hysop.backend.host.python.operator.directional.advection_dir module

class hysop.backend.host.python.operator.directional.advection_dir.PythonDirectionalAdvection(**kwds)[source]

Bases: DirectionalAdvectionBase, HostDirectionalOperator

Particle advection of field(s) in a given direction, on any backend, with cartesian remeshing.

Parameters:
  • velocity (Field) – Continuous velocity field (all components)

  • splitting_direction (int) – The splitting direction.

  • advected_fields_in (Field or array like of Fields) – Instance or list of continuous fields to be advected.

  • advected_fields_out (Field or array like of Field) – Where input fields should be remeshed.

  • relative_velocity (array-like relative velocities, optional) – Relative velocity that has to be taken into account. Vi = Ui - Urel[i] for each components.

  • variables (dict) – Dictionary of continuous fields as keys and topologies as values.

  • dt (ScalarParameter) – Timestep parameter that will be used for time integration.

  • velocity_cfl (float or tuple) – Velocity cfl in given direction. In case of tuple given, value is taken from splitting direction.

  • remesh_criteria_eps (int) – Minimum number of epsilons (in specified precision) that will trigger remeshing. By default every non zero value is remeshed.

  • kwds – Extra parameters passed to generated directional operators.

velocity

Continuous velocity field (all components)

Type:

Field

advected_fields_in

Tuple of continuous fields to be advected.

Type:

list

advected_fields_out

Tuple of output continuous fields.

Type:

list

apply(**kwds)

Abstract method that should be implemented. Applies this node (operator, computational graph operator…).

classmethod available_methods()[source]

Returns the available methods of this node. This should return a dictionary of method as keys and possible values as a scalar or an iterable. See hysop.types.InstanceOf to support specific class types. This is used to check user method input.

counter = 0
classmethod default_method()[source]

Returns the default method of this node. Default methods should be compatible with available_methods. If the user provided method dictionnaty misses some method keys, a default value for this key will be extracted from the default one.

get_work_properties()[source]

Returns extra memory requirements of this operator. This allows operators to request for temporary buffers that will be shared between operators in a graph to reduce the memory footprint and the number of allocations.

Returned memory is only usable during operator call (ie. in self.apply). Temporary buffers may be shared between different operators as determined by the graph builder.

By default if there is no input nor output temprary fields, this returns no requests, meanning that this node requires no extra buffers.

If temporary fields are present, their memory request are automatically computed and returned.

handle_method(method)[source]

Method automatically called during initialization. This allow to extract method values after method preprocessing. Method preprocessing means:

  1. complete user input with compatible top graph user inputs

  2. complete the resulting dictionnary with the node default_method

  3. check method against available_methods.

The result of this process is fed as argument of this function.

setup(work)[source]

Setup temporary buffer that have been requested in get_work_properties(). This function may be used to execute post allocation routines. This sets self.ready flag to True. Once this flag is set one may call ComputationalGraphNode.apply() and ComputationalGraphNode.finalize().

Automatically honour temporary field memory requests.

classmethod supports_mpi()[source]

Return True if this operator was implemented to support multiple mpi processes.